<template>
  <view class="pageBg pdb150 pd2628 box-b">

<!--    <view class="box-b mgb26">-->
<!--      <view v-if="memberInfo" class="flex-align pd28 box-b bgff radius12">-->
<!--        <view class="ovfh radius50p">-->
<!--          <c-image-->
<!--            v-if="memberInfo.logo || memberInfo.avatarUrl"-->
<!--            className="img114 disb"-->
<!--            :src="memberInfo.logo || memberInfo.avatarUrl"-->
<!--            :errorImageUrl="imagePrefix + 'logo.png'"-->
<!--          ></c-image>-->
<!--          <view v-else class="img114 bg80 ovfh radius50p">-->
<!--            <c-image-->
<!--              className="img114 disb"-->
<!--              customNullImg="logo.png"-->
<!--              :errorImageUrl="imagePrefix + 'logo.png'"-->
<!--            ></c-image>-->
<!--          </view>-->
<!--        </view>-->
<!--        <view class="flex1 mgl34 ell">-->
<!--          <tempalte v-if="memberInfo.nickName || memberInfo.personalProfile">-->
<!--            <view class="fs28 color1a ffmi fw600 mgb10 ell">-->
<!--              {{ memberInfo.nickName || '' }}-->
<!--            </view>-->
<!--            <view class="fs24 color4d zhedie lh28">-->
<!--              {{ memberInfo.personalProfile || '' }}-->
<!--            </view>-->
<!--          </tempalte>-->
<!--          <view v-else class="fs28 color4d zhedie lh32">已授权</view>-->
<!--        </view>-->
<!--      </view>-->
<!--      <view v-else class="flex-align pd28 box-b bgff radius12">-->
<!--        <view class="ovfh radius50p" @click="onChooseAvatar">-->
<!--          <c-image-->
<!--            className="img114 disb"-->
<!--            :customNullImgShow="true"-->
<!--            customNullImg="logo.png"-->
<!--            :errorImageUrl="imagePrefix + 'logo.png'"-->
<!--          ></c-image>-->
<!--        </view>-->
<!--        <view class="flex1 mgl34 ell">-->
<!--          <view class="fs28 color4d zhedie lh32">未授权</view>-->
<!--        </view>-->
<!--      </view>-->
<!--    </view>-->

<!--    <view class="betweenBox minh104 pd42524248 box-b bgff radius12 mgb26 color1a" @click="invoiceIssue">-->
<!--      <view class="flex-align">-->
<!--        <server-image-->
<!--          class="img96 mga disb"-->
<!--          name="repair/20241209001.png"-->
<!--          mode="aspectFill" />-->
<!--        <view class="lh36 fs34 ffmi mgl30">开具发票</view>-->
<!--      </view>-->
<!--      <view class="jsend">-->
<!--        <server-image-->
<!--          class="img1630 disb"-->
<!--          name="repair/20241028012.png"-->
<!--          resize="_r72xp"-->
<!--        ></server-image>-->
<!--      </view>-->
<!--    </view>-->
<!--    <view-->
<!--      class="betweenBox minh104 pd42524248 box-b bgff radius12 mgb26 color1a"-->
<!--      @click="toPage('/pages/addressManage/addressManage', true)"-->
<!--    >-->
<!--      <view class="flex-align">-->
<!--        <server-image-->
<!--          class="img96 mga disb"-->
<!--          name="repair/20241209001.png"-->
<!--          mode="aspectFill" />-->
<!--        <view class="lh36 fs34 ffmi mgl30">地址管理</view>-->
<!--      </view>-->
<!--      <view class="jsend">-->
<!--        <server-image class="img1630 disb" name="repair/20241028012.png" resize="_r72xp"></server-image>-->
<!--      </view>-->
<!--    </view>-->

    <view class="betweenBox minh104 pd42524248 box-b bgff radius12 mgb26 color1a" @click="repairNotice(1,'报修须知')">
      <view class="flex-align">
        <server-image
          class="img96 mga disb"
          name="repair/20241209002.png"
          mode="aspectFill" />
        <view class="lh36 fs34 ffmi mgl30">报修须知</view>
      </view>
      <view class="jsend">
        <server-image
          class="img1630 disb"
          name="repair/20241028012.png"
          resize="_r72xp"
        ></server-image>
      </view>
    </view>
    <view class="betweenBox minh104 pd42524248 box-b bgff radius12 mgb26 color1a" @click="repairNotice(2,'联系我们')">
      <view class="flex-align">
        <server-image
          class="img96 mga disb"
          name="repair/20241209003.png"
          mode="aspectFill" />
        <view class="lh36 fs34 ffmi mgl30">联系我们</view>
      </view>
      <view class="jsend">
        <server-image
          class="img1630 disb"
          name="repair/20241028012.png"
          resize="_r72xp"
        ></server-image>
      </view>
    </view>
<!--    <view class="betweenBox minh104 pd42524248 box-b bgff radius12 mgb26 color1a" @click="repairNotice(3,'意见反馈')">-->
<!--      <view class="flex-align">-->
<!--        <server-image-->
<!--          class="img96 mga disb"-->
<!--          name="repair/20241209004.png"-->
<!--          mode="aspectFill" />-->
<!--        <view class="lh36 fs34 ffmi mgl30">意见反馈</view>-->
<!--      </view>-->
<!--      <view class="jsend">-->
<!--        <server-image-->
<!--          class="img1630 disb"-->
<!--          name="repair/20241028012.png"-->
<!--          resize="_r72xp"-->
<!--        ></server-image>-->
<!--      </view>-->
<!--    </view>-->

    <!--    <no-data-->
    <!--      classStyle="width:213rpx;height:182rpx;margin: 225rpx auto 53rpx;"-->
    <!--      titleColor="#808080"-->
    <!--      nullName="noData.png"-->
    <!--    ></no-data>-->

    <!-- <view
        class="flex-box mga absolute left30 bottom30"
        v-if="memberInfo">
      <view
          class="w690 h80 flex-box bgcc colorff radius12 fs26"
          @click="logout">
        退出登录
      </view>
    </view> -->
  </view>
</template>

<script>
import { mapState } from 'vuex';
export default {
  data() {
    return {};
  },
  onShow() {},
  onPullDownRefresh() {
    // this.$store.dispatch('getMemberInfo').then(()=>{
    //   uni.stopPullDownRefresh();
    // })
    setTimeout(() => {
      uni.stopPullDownRefresh();
    }, 1000);
  },
  async onLoad() {
    const vm = this;

    // if (!this.memberInfo) {
    //   uni.navigateTo({
    //   	url: '/pages/login/login'
    //   });
    //   return;
    // } else {
    //   this.$store.dispatch('getMemberInfo');
    // }
    if (!vm.memberInfo.openid) {
      await vm.$store.dispatch('check_wx_login');
    }
  },
  computed: mapState(['memberInfo']),
  methods: {
    logout() {
      this.$store.commit('logout');
    },
    invoiceIssue() {
      const vm = this;
      vm.showMessage({
        title: '暂未开放，敬请期待。',
        duration: 1500,
      });
      // vm.toPage('/pages/packages/member/invoice/invoice', true)
    },
    onChooseAvatar() {
      let vm = this;
      if (vm.$pallet != 'MP-WEIXIN') return;
      uni.login({
        provider: 'weixin',
        success: function (loginRes) {
          console.log('loginRes', loginRes); // 打印登录凭证
          // 使用登录凭证获取用户信息
          uni.getUserInfo({
            provider: 'weixin',
            success: function (infoRes) {
              console.log(infoRes.userInfo); // 打印用户信息
              console.log('用户昵称为: ' + infoRes.userInfo.nickName); // 打印用户昵称
              vm.$store.commit('saveMember', infoRes.userInfo);
              // 在这里，你可以将用户的头像和昵称保存到本地或者发送到后端进行处理
              // infoRes.userInfo.avatarUrl是用户的头像链接
              // infoRes.userInfo.nickName是用户的昵称
            },
          });
        },
      });
    },
    repairNotice(type=1,title='报修须知') {
      const vm = this;
      vm.toPage('/pages/index/webPage/webPage?type=' + type + '&title='+title, true);
      // vm.api_ui_getguidepic();
    },
    api_ui_getguidepic() {
      const vm = this;

      uni.showLoading({
        title: '加载中...',
      });
      return new Promise(function (resolve) {
        vm.apiUrl.api_ui_getguidepic().then(async (res) => {
          uni.hideLoading();
          const { code, msg: message = '', data } = res.data;
          if (code == 0) {
            let swiperContent = await vm.filterSpecialSymbol(data.repairnotice);
            uni.setStorageSync('swiperContent', swiperContent);
            vm.toPage('/pages/index/webPage/webPage?richText=' + true, true);
          } else {
            vm.showMessage({
              title: message,
              icon: 'error',
              duration: 1500,
            });
          }
          resolve();
        });
      });
    },
  },
};
</script>

<style lang="less" scoped></style>
